﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SistemaDePedidos.ServiceReference1;


namespace SistemaDePedidos
{
    public partial class frmPedidos : Form
    {
        public frmPedidos()
        {
            InitializeComponent();
        }

        ServiceReference1.Fachada servicio;

        private void button3_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataGridView2.Rows)
            {
               if (Convert.ToBoolean(row.Cells[0].Value))
               {
                int ID = Convert.ToInt32(row.Cells[2].Value);

                   servicio = new FachadaClient();
                   servicio.SetFacturado(ID);
               }
            }

            MessageBox.Show("Los pedidos fueron cambiados a facturados");

            servicio = new FachadaClient();
            PedidosService[] mt = servicio.GetPedidos();
            dataGridView2.DataSource = mt;

        }

        private void button2_Click(object sender, EventArgs e)
        {

            servicio = new FachadaClient();
            PedidosService[] mt = servicio.GetPedidos();
            dataGridView2.DataSource = mt;
        }

        private void frmPedidos_Load(object sender, EventArgs e)
        {

        }

    }


}

       